/* 
 * File:   Enemy.h
 * Author: paula
 *
 * Created on 7 de noviembre de 2014, 14:27
 */

#ifndef ENEMY_H
#define	ENEMY_H

#include "Character.h"
#include "Bullet.h"
#include "FireBall.h"
using namespace std;

class Enemy : public Character {
public:
    Enemy();
    Enemy(ObjFactory *objFactory, int x, int y, int id);
    Enemy(const Enemy& orig);
    virtual ~Enemy();

    void keepWalking();
    void walk();
    //shoot
    bool inConctactBullet();
    bool inConctactCrazyBall();
    bool toKick();
    bool toDie();

    void beCaught();
    void updateData();
    void updateState();

    void setCrazyBall();
    bool isCrazyBall();

    int getState();
    bool getAreEquals();
    void jumpRandom();
    //    SnowBall* shootRandom();
    void checkChanges();
    void checkContacts();
    
    
    bool isCaught();

    void escape();
    void kill();
    void setTrap(bool flag);

    void changePosition(float x, float y);

    bool tryToDelete();
    float getPosToBonusX();
    float getPosToBonusY();
    
    bool alive;

private:
    void beRandom();
    int getCantCont();
    void killMyContactsEnemies();
    
    vector<b2Body*> charactersTrapped;
    
    float posAntX;
    int counterRight, counterLeft, counterSnow, counterEscaping;
    bool caught;
    bool escaping;
    bool kicked;
    bool kickedFromRight;
    bool dead;
    
    bool isACrazyBall;
    bool isTrapped;

    float posToBonusX;
    float posToBonusY;

    std::chrono::time_point<std::chrono::system_clock> cronoStart;
    std::chrono::time_point<std::chrono::system_clock> cronoNow;

    std::chrono::time_point<std::chrono::system_clock> cronoStartDead;
    std::chrono::time_point<std::chrono::system_clock> cronoNowDead;

    int timeUncaught;
    int timeToDisappear;
    void disappear();
    
    // donde se envian los characters atrapados por la crazy ball
    float posDisappear;

};

#endif	/* ENEMY_H */

